<?php
/**
 * 归档
 *
 * @package custom
 */
?>
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
 $this->need('header.php');
?>
<div class="wrap">
    <div class="am-g">
        <?php $this->need('sidebar.php'); ?>
        <div class="am-u-lg-10">
            <div class="main am-cf">
                <?php $this->need('top.php'); ?>
                <div class="content" id="content">
                    <div class="am-g am-u-sm-centered">
                        <div class="am-u-sm-12" style="padding: 0;">
							<?php 
								$this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
								$year=0; $mon=0;
								$output = '';
								$index = preg_replace('/\/$/','',$this->options->index).'/';
								while($archives->next()){
									$year_tmp = date('Y',$archives->created);
									$mon_tmp = date('m',$archives->created);
									$y=$year; $m=$mon;
									if ($mon != $mon_tmp && $mon > 0) $output .= '</ul>';
									if ($year != $year_tmp && $year > 0) $output .= '</div>';
									if ($year != $year_tmp) {
										$year = $year_tmp;
										$output .= '<div class="archives"><h2><a href="'.$index.$year.'">'.$year.' 年</a></h2>';
									}
									if ($mon != $mon_tmp) {
										$mon = $mon_tmp;
										$output .= '<ul><h3><a href="'.$index.$year.'/'.$mon.'">'.$mon.' 月</a></h3>';
									}
									$day = date('d',$archives->created);
									$output .= '<li><a href="'.$index.$year.'/'.$mon.'/'.$day.'">'.$day.'日</a>: <a href="'.$archives->permalink.'">'.
									$archives->title.'';
								}
								$output .= '</ul>';
								echo $output;
							?>
						</div>
                    </div>
                </div>
            </div>
            <?php $this->need('footer.php'); ?>
        </div>
    </div>
</div>